// 草图 - 圆角
import { BaseCommand } from '@amcax/base';

import { useEffect, useRef } from 'react';

import { CmdInteractor } from './CmdInteractor';

interface ChamferDialogProps {
  title: string;
  onClose: () => void;
}
function ChamferCommand({ onClose }: ChamferDialogProps) {
  const cmdRef = useRef<CmdInteractor>(null);
  useEffect(() => {
    cmdRef.current = new CmdInteractor();
    cmdRef.current.addExit(onClose);
    return () => {
      cmdRef.current?.destroy();
      cmdRef.current = null;
    };
  }, []);

  return <></>;
}

export const cmdChamfer: BaseCommand = {
  id: 'CmdChamfer',
  label: 'command.chamfer',
  icon: 'commands/sketch/sketch-chamfer',
  group: 'sketch',
  create: (label: string, onClose: () => void) => (
    <ChamferCommand
      title=''
      onClose={onClose}
    />
  ),
};
